{include file="head" title="图片类别修改" /}
        <div class="layui-fluid">
            <div class="layui-card">
                <div class="layui-card-header">图片类别修改</div>
                <div class="layui-card-body" style="padding: 15px;">
                    <form id="form" class="layui-form" action="{:url('pictypes/pictype_submit');}"  method="post" style="width:50%;">
                        <input type="hidden" name='id' value="{:input('id')}"> 
                        <div class="layui-form-item">
                            <label class="layui-form-label">图片类别：</label>
                            <div class="layui-input-block">
                                <input type="text" name="name" value="{$s->name}" lay-verify="required" autocomplete="off" placeholder="请输入图片类别" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">备注：</label>
                            <div class="layui-input-block">
                                <input type="text" name="note" value="{$s->note}" lay-verify="required" autocomplete="off" placeholder="请输入备注" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="sub">立即提交</button>
                                <button type="button" class="layui-btn layui-btn-primary" onclick="javascript:history.back(-1)">返回</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>

<script>
    layui.config({
        base: '{$Think.const.admin_tpl}/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'laydate'], function () {
        var $ = layui.$
                , layer = layui.layer
                , form = layui.form;
                
        /* 监听提交 */
        form.on('submit(sub)', function (data) {
            console.log($("#form").serialize());
            $.ajax({
                url: "/admin/pictypes/pictype_submit/",
                type: 'post',
                data: $("#form").serialize(),
                dataType: 'json',
                success: function (data) {
                    console.log(data);
                    if (data.status == 1)
                    {
                        layer.confirm('操作成功！请选择？', {
                            btn: ['继续编辑', '返回列表'] //按钮
                        }, function () {
                            location.reload();
                        }, function () {
                            location.href = '/admin/pictypes/index.html';
                        });
                    }
                    else
                    {
                        layer.msg(data.msg);
                    }
                },
                error: function (msg) {
                    alert(" 数据保存失败！" + msg);
                }
            });
            return false;
        });
    });
</script>
{include file="foot" /}